import request from '@/utils/request'

/*
获取部门数据
*/
export function getDepartments() {
  return request({
    url: '/company/department'
    // method: 'get' 因为axios默认是get 所以这里可以不写
    // 需要传递 token 因为请求拦截器配置了 这里也可以不写
  })
}

/* **
封装获取指定部门信息模块
** */
export function getDetailDepartments(id) {
  return request({
    url: `/company/department/${id}`
  })
}

/*
删除部门数据
*/
export function DelDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'Delete'
  })
}

/* *
添加部门
* */

export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/*
编辑部门
*/

export function editDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
